# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Nissar Chababy <funilrys at outlook dot com>
# Contributor: Thrasibule <guillaume dot horel at gmail dot com>
# Contributor: David Manouchehri <manouchehri@riseup.net>
# Contributor: Vladimir Tsanev <tsachev@gmail.com>
# Contributor: Andrew Reed <reed.996@osu.edu>
# Contributor: "Score_Under" <seejay.11@gmail.com>

pkgname=python-lz4
_pkgname=lz4
pkgver=4.3.2
pkgrel=1
pkgdesc="LZ4 bindings for Python"
arch=('loong64' 'x86_64')
license=('BSD')
url="https://github.com/python-lz4/python-lz4"
depends=('python')
makedepends=('python-build' 'python-installer' 'python-pkgconfig' 'python-setuptools-scm' 'python-wheel')
checkdepends=('python-pytest' 'python-psutil')
source=("https://pypi.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-${pkgver}.tar.gz")
sha512sums=('c2e7d3ec0954110c9b21e562147e80c8abddd21ebb213491d1072454834151a0f3a0935c0f3eebec34c024fe6e79136ccf6363dcb5390aa03cb52489fcb4113c')

build() {
  cd "$srcdir"/$_pkgname-$pkgver
  PYLZ4_EXPERIMENTAL=1 \
  python -m build --wheel --no-isolation
}

check() {
  cd "$srcdir"/$_pkgname-$pkgver
  mv lz4{,.bak}
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
